{% extends "wenjuan/base.html" %}

{% load staticfiles %}
{% block description %}公大问卷平台{%endblock%}
{% block title %}公大问卷平台{% endblock %}



{% block main_content %}





<!-- 主容器开通-->
<div class="container" >
    <!-- 问卷标题-->
	<div class="page-header">
	<h1 class="text-center">开放问卷平台</h1>
  
    
    </div>
    <!-- 问卷标题 end -->
    
    <div class="row">
    	<!-- 左侧 -->
    	<div class="col-md-2" >
        <p>
        题目数量:{{tnumber}}
        </p>
       </div>
       <!-- 左侧 end -->
       
       <!-- 正文 -->
       <div class="col-md-8">


            <form method="post" action="/wenjuan/jieguo/" role="form">

        {% csrf_token %}
     
        <input type='hidden' name='wjid' value='{{wenjuan_id}}'> 
        <input type='hidden' name='wjkey' value='{{wjkey}}'> 
     

         {% for item in tmarray %}
      <!-- 题目 01-->
         <div class="panel panel-primary">
      <div class="panel-heading">
        <h3 class="panel-title">{{ forloop.counter }} .{{item.tigan}}</h3>
      </div>
      <div class="panel-body">
          <div style="margin-left:10px">
                
       {{item.getxuanxiang | safe}}
                
                </div>
        
      </div>
    </div>
        
       <!-- 题目 01 end-->
         {% endfor %}
      
        <div class="form-group text-center">
          <button id="btnSubmit" type="submit" class="btn btn-primary text-center">提交问卷</button>
           
        </div>
      </form>
       
       
    </div>
    <!--  正文  end-->
    
 </div>  
 <!-- 主容器结束--> 


{% endblock %}

 {% block script %} 

<script type="text/javascript" language="javascript">
 /*------判断radio是否有选中，获取选中的值--------*/
    $(function(){
      $("a").click(function(event) {
           alert("填写问卷期间，无法跳转。请您耐心回答问题！");//获取事件类型
        return false;//阻止链接跳转
      });
         $("#btnSubmit").click(function(){
            allNum={{tnumber}}
            checkedNum=$('input:radio:checked').length
            subNum=allNum-checkedNum
            //console.log("xxxx: "+subNum+" 题未回答!");
            if(allNum!=checkedNum){
                
                alert("还有 "+subNum+" 道题未回答!");
                return false;
            }
            //return false;
          
         });
     });
</script>

 {% endblock %}